package net.tw.transactional2.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
@Transactional
public class PersonDao {

    @Autowired
    JdbcTemplate jdbcTemplate;

    public void insertName() {
        String name = Thread.currentThread().getName();
        long id = Thread.currentThread().getId();
        jdbcTemplate.update("insert into person values (?,?)", name, id);
    }
}
